<template>
  <div class="department-container">
    <div class="app-container">
      <el-card>
        <el-row type="flex" justify="space-between" align="middle" style="height:40px">
          <el-col :span="20">
            <svg-icon icon-class="home" />
            <span>江苏传智播客教育科技股份有限公司</span>
          </el-col>
          <el-col :span="4">
            <el-row type="flex" justify="end">
              <el-col>负责人</el-col>
              <el-col>
                <el-dropdown>
                  <span>
                    操作<i class="el-icon-arrow-down" />
                  </span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>添加子部门</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </el-col>
            </el-row>
          </el-col>
        </el-row>
        <!-- 树形布局的结构 -->
        <el-tree :data="depart" :props="defaultProps" default-expand-all @node-click="handleNodeClick">
          <template v-slot="{data}">
            <el-row type="flex" justify="space-between" align="middle" style="height:40px; width:100%">
              <el-col :span="20">
                <svg-icon icon-class="home" />
                <span>{{ data.name }}</span>
              </el-col>
              <el-col :span="4">
                <el-row type="flex" justify="end">
                  <el-col>负责人</el-col>
                  <el-col>
                    <el-dropdown>
                      <span>
                        操作<i class="el-icon-arrow-down" />
                      </span>
                      <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item>添加子部门</el-dropdown-item>
                        <el-dropdown-item>编辑部门</el-dropdown-item>
                        <el-dropdown-item>删除部门</el-dropdown-item>
                      </el-dropdown-menu>
                    </el-dropdown>
                  </el-col>
                </el-row>
              </el-col>
            </el-row>
          </template>
        </el-tree>
      </el-card>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      depart: [{
        name: '一级 1',
        child: [{
          name: '二级 1-1',
          child: [{
            name: '三级 1-1-1'
          }]
        }]
      }
      ],
      defaultProps: {
        children: 'child',
        label: 'name'
      }
    }
  }
}
</script>

